@extends('admin::layouts.master')

@section('content')
    <form action="{{route('permission',$roles['id'])}}" method="post" style="border-radius: 0px;">
        <div class="col-md-12">
            <div class="card card-border-color card-border-color-primary">
                <div class="card-header card-header-divider">给{{$roles['title']}}分配权限</div>
                @csrf
                @foreach($permissions as $v)
                    <div class="form-group row pt-1 pb-1">
                        @foreach($v['rules'] as $vv)
                            <label class="col-12 col-sm-3 mt-1 col-form-label text-sm-right ml-8" style="font-size: 20px">{{$vv['group']}}:</label>
                            <div class="col-12 col-sm-8 form-check mt-4">
                                @foreach($vv['permissions'] as $value)
                                    <label class="custom-control custom-checkbox custom-control-inline">
                                        <input type="checkbox" @if($roles->hasPermissionTo($value['name'])) checked @endif name="name[]" class="custom-control-input is-valid" value="{{$value['name']}}">
                                        <span class="custom-control-label custom-control-color">{{$value['title']}}</span>
                                    </label>
                                @endforeach
                            </div>
                        @endforeach
                    </div>
                @endforeach
                <button type="submit" class="btn btn-primary btn-lg btn-block">提交</button>
            </div>
        </div>
    </form>
@stop